#ifndef SETTINGHANDLER_H
#define SETTINGHANDLER_H

#include <QFile>
#include <QColor>

class SettingHandler
{
public:
    static SettingHandler* get_instance();
    ~SettingHandler();
    bool load_setting_file();
    void write_all();

    inline int get_lnk_size() {return lnk_size;}
    inline void set_lnk_size(int new_lnk_size) {lnk_size = new_lnk_size;}
    inline int get_widget_height() {return widget_height;}
    inline void set_widget_height(int new_widget_height) {widget_height = new_widget_height;}
    inline int get_margin_bottom() {return margin_bottom;}
    inline void set_margin_bottom(int new_margin_bottom) {margin_bottom = new_margin_bottom;}
    inline int get_border_size() {return (widget_height - lnk_size) / 2;}
    inline int get_dx() {return lnk_size + get_border_size();}
    inline int get_widget_radius() {return widget_radius;}
    inline void set_widget_radius(int new_widget_radius) {widget_radius = new_widget_radius;}
    inline bool get_show_clock() {return show_clock;}
    inline void set_show_clock(bool new_show_clock) {show_clock = new_show_clock;}
    inline int get_back_time() {return back_time;}
    inline void set_back_time(int new_back_time) {back_time = new_back_time;}
    inline QColor get_background_color() {return background_color;}
    inline void set_background_color(const QColor & new_color) {background_color = new_color;}
    inline QColor get_border_color() {return border_color;}
    inline void set_border_color(const QColor & new_color) {border_color = new_color;}

private:
    SettingHandler();
    QMap<QString, QStringList> read_all();

    int lnk_size;
    int widget_height;
    int margin_bottom;
    int widget_radius;
    bool show_clock;
    int back_time;
    QColor background_color;
    QColor border_color;
    QFile file;
};

#endif // SETTINGHANDLER_H
